<!doctype html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>已安装插件列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="/static/bootstrap/bootstrap.min.css?v=3.3.7" rel="stylesheet">
    <link href="../../css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="../../css/animate.min.css?v=4.0.0" rel="stylesheet">
    <link href="../../css/style.min.css?v=4.0.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="container-fluid topmenu">
        <h2><i class="fa fa-puzzle-piece"></i> 已安装插件</h2>
    </div>
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>已安装插件列表</h5>
                    </div>
                    <div class="ibox-content">

                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th>序号</th>
                                    <th>插件名</th>
                                    <th>中文名称</th>
                                    <th>简介</th>
                                    <th>版本号</th>
                                    <th class="text-center">系统插件</th>
                                    <th class="text-center">自启动</th>
                                    <th class="text-center">是否启用</th>
                                    <th class="text-center">管理</th>
                                </tr>
                            </thead>
                            <tbody id="tabbody">

                            </tbody>
                        </table>

                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 全局js -->
    <script src="/static/jquery/jquery.min.js?v=2.1.4" type="text/javascript"></script>
    <script src="/static/bootstrap/bootstrap.min.js?v=3.3.7" type="text/javascript"></script>
    <script src="../../js/content.js?v=1.0.0"></script>

    <!-- 自定义全局js -->
    <script src="../../js-user/public.js" type="text/javascript"></script>

    <!-- 自定义js -->
    <script>
        $(function () {
            var urlapi = '../../py/plugin_list.py?op=getlist&r=' + Math.random()
            $.ajax({
                type: "POST",
                url: urlapi,
                dataType: 'json',
                success: function (msg) {
                    if (msg.code == '0000') {
                        var data = msg.data;
                        var tabhtml = '';
                        $.each(data, function (i, n) {
                            tabhtml += '<tr><td>' + i + '</td><td><a href="mypluginedit.html?name=' + n.name + '">' + n.name + '</a></td>';
                            tabhtml += '<td>' + n.displayName + '</td><td>' + n.description.substr(0, 40);
                            if (n.description.length > 40) { tabhtml += '…'; }
                            tabhtml += '</td><td>' + n.version + '</td>';
                            tabhtml += '<td class="text-center">';
                            if (n.IsSystem) {
                                tabhtml += '<span class="label label-success">是</span>';
                            } else {
                                tabhtml += '<span class="label label-default">否</span>';
                            }
                            tabhtml += '</td><td class="text-center">';
                            if (n.AutoLoader) {
                                tabhtml += '<span class="label label-success">是</span>';
                            } else {
                                tabhtml += '<span class="label label-default">否</span>';
                            }
                            tabhtml += '</td><td class="text-center">';
                            if (n.IsEnable) {
                                tabhtml += '<span class="label label-success">启用</span>';
                            } else {
                                tabhtml += '<span class="label label-default">停用</span>';
                            }
                            tabhtml += '</td><td class="text-center"><a class="btn btn-primary btn-xs" href="mypluginedit.html?name=' + n.name + '" role="button">管理</a></td></tr>';
                        });
                        $('#tabbody').html(tabhtml);
                    }
                }
            });
        });
    </script>
</body>

</html>